#include <stdio.h>
struct student					
{
int num;
char name[15];
float score[3];
float sum;
};
void calc(struct student *p,int n);	 
void sort(struct student *p,int n);
int main()
{
struct student stu[5];
int i,j;
float f;
for(i=0;i<5;i++)
{
	scanf("%d%s",&stu[i].num,stu[i].name);
	for(j=0;j<3;j++)
	{ 
    	scanf("%f",&f);
		stu[i].score[j]=f;
	}
}
calc(stu,5);
sort(stu,5);
for(i=0;i<5;i++)
{
	printf("%5d%15s",stu[i].num,stu[i].name);
	printf("  %.1f  %.1f  %.1f  %.1f\n",stu[i].score[0],stu[i].score[1],stu[i].score[2], stu[i].sum);
}
return 0;
void calc(struct student *p,int n){
  int i;
  for(i=0;i<n;i++){
    (p+i)->sum=(p+i)->score[0]+(p+i)->score[1]+(p+i)->score[2];
  }
}
void sort(struct student *p,int n){
  int i,j,k;
  k=0;
      struct student t;
    for(i=0;i<n-1;i++){
        k=i;
        for(j=i;j<n;j++){
            if(((p+k)->sum)<((p+j)->sum)){
                k=j;
            }
        }
        if(k!=i){
            t=*(p+i);*(p+i)=*(p+k);*(p+k)=t;
        }
    }
}
